function Toast(msg,duration){
    duration=isNaN(duration)?3000:duration;
    var m = document.createElement('div');
    m.innerHTML = msg;
    m.style.cssText="max-width:60%;min-width: 150px;padding:0 14px;height: 40px;color: rgb(255, 255, 255);line-height: 40px;text-align: center;border-radius: 4px;position: fixed;top: 10%;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: rgba(0, 0, 0,.7);font-size: 16px;";
    document.body.appendChild(m);
    setTimeout(function() {
        var d = 0.5;
        m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
        m.style.opacity = '0';
        setTimeout(function() { document.body.removeChild(m) }, d * 1000);
    }, duration);
}

function copyText(data) {
    //var text = document.getElementById("text").innerText;
    var input = document.getElementById("input");

    var str = data.parentNode.innerText.trim();
    if(str.match(/^(男|女|\d+|\(\d+\)|\d+\)|\d+）|（\d+）){1}[\:：，,.。、]/)) {
        var arr = str.match(/(?<=[:：，,.。、])(\S*)/);
        if (arr.length >= 2) {
            str = str.match(/(?<=[:：，,.。、])(\S*)/)[1];
        }
    }
    input.value = str.replace(/[\(|（](.*?)[\)|）]/, ""); // 修改文本框的内容
    input.select(); // 选中文本
    document.execCommand("copy"); // 执行浏览器复制命令
    Toast("复制成功", 1000);
}